package com.zhangxu.microservice.system.web.convert;

import com.zhangxu.microservice.system.biz.dto.ApplicationDTO;
import com.zhangxu.microservice.system.biz.dto.CreateApplicationDTO;
import com.zhangxu.microservice.system.biz.dto.UpdateApplicationDTO;
import com.zhangxu.microservice.system.web.request.CreateApplicationReq;
import com.zhangxu.microservice.system.web.request.UpdateApplicationReq;
import com.zhangxu.microservice.system.web.response.ApplicationResp;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;

/**
 * 系统Web层对象转换接口
 */
@Mapper(componentModel = "spring")
public interface ApplicationWebConverter {

    /**
     * CreateSystemReq 转 CreateSystemDTO
     *
     * @param createApplicationReq 创建应用请求
     * @return 创建系统DTO
     */
    CreateApplicationDTO toCreateApplicationDTO(CreateApplicationReq createApplicationReq);

    /**
     * UpdateSystemReq 转 UpdateSystemDTO
     *
     * @param updateApplicationReq 更新应用请求
     * @return 更新系统DTO
     */
    @Mapping(target = "id", ignore = true)
    UpdateApplicationDTO toUpdateApplicationDTO(UpdateApplicationReq updateApplicationReq);

    /**
     * SystemDTO 转 SystemResp
     *
     * @param applicationDTO 系统DTO
     * @return 系统响应
     */
    ApplicationResp toApplicationResp(ApplicationDTO applicationDTO);
}